package org.other.testPk;

/**
 * @Author yu
 * @Date 2022/7/8
 */
public class Demo4 {

    public static void main(String[] args) {

        System.out.println(numWays2(7));

    }

    public static int numWays(int n) {
        int a = 1, b = 1, sum;
        for(int i = 0; i < n; i++){
            sum = (a + b) % 1000000007;
            a = b;
            b = sum;
        }
        return a;
    }

    public static int numWays2(int n) {
        int a = 1, b = 1, sum, temp = 0;
        for(int i = 0; i < n; i++){
            sum = temp + b;
            temp = a;
            a = b;
            b = sum;
        }
        return a;
    }

}
